#define _CRT_SECURE_NO_WARNINGS 1

class Solution {
public:
    int maxArea(vector<int>& height) {
        int left = 0, right = height.size() - 1, ret = 0;
        while (left != right) {
            int s = min(height[left], height[right]) * (right - left);
            ret = max(ret, s);
            if (height[left] <= height[right])
                left++;
            else
                right--;

        }
        return ret;

    }
};

class Solution {
public:
    int Sum(int n) {
        int sum = 0;
        while (n) {
            int m = n % 10;
            sum += m * m;
            n /= 10;
        }
        return sum;
    }
    bool isHappy(int n) {
        int slow = n, fast = Sum(n);
        while (slow != fast) {
            slow = Sum(slow);
            fast = Sum(Sum(fast));
        }
        return slow == 1;
    }
};